package per.dj.testpro.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import per.dj.testpro.entity.UserInfo;

import java.util.HashMap;
import java.util.Map;

@RestController
@Api("swaggerTest")
public class TestController {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);

    @PostMapping(value = "/test")
    public ResponseEntity<Map<String, Object>> getUserInfo(@RequestBody @ApiParam(name = "用户对象",required = true) UserInfo userInfo){
        Map<String, Object> map = new HashMap<>();
        map.put("data", "Hello world");
        map.put("name",userInfo.getName());
        LOGGER.info(map.toString());
        return new ResponseEntity<>(map, HttpStatus.OK);
    }

}
